#!/usr/bin/env bash


help(){
    cat<<__EOF__
Usage: m safeboot [ --status | --enable | --disable | --help ]

Description: Enable or disable safe boot on macOS

Options:
  --help      Show this help message
  --status    Get the current boot arguments
  --enable    Enable safe boot-args
  --disable   Disable safe boot-args
__EOF__
}


case $1 in
    --help)
        help
        ;;
    --enable)
        sudo nvram boot-args="-x"
        echo "safeboot: enabled"
        ;;
    --disable)
        sudo nvram boot-args=""
        echo "safeboot: disabled"
        ;;
    --status)
        nvram boot-args
        ;;
    *)
        help && exit 1
        ;;
esac
